package cn.lingyangwl.agile.pay.pay.controller.bill;

import cn.lingyangwl.agile.pay.common.service.BillService;
import cn.lingyangwl.agile.pay.pay.model.rqrs.bill.BillQueryRQ;
import cn.lingyangwl.agile.ram.ActionType;
import cn.lingyangwl.agile.ram.RamResource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author shenguangyang
 */
@Slf4j
@RestController
@RequestMapping("/bill")
public class BillController {
    @Resource
    private BillService billService;

    /**
     * 下载账单
     */
    @GetMapping("/download")
    @RamResource(action = "pay:bill:download", name = "下载账单", type = ActionType.READ)
    public void downloadBill(@RequestParam @Validated BillQueryRQ req) throws Exception {
        billService.downloadBill(req);
    }
}
